package com.luoke.handler;

import com.luoke.constant.SubmoduleTypeConstant;
import com.luoke.result.Result;
import com.luoke.service.UserResponseService;
import com.luoke.service.impl.UserResponseServiceImpl;
import org.java_websocket.WebSocket;

/**
 * 用户响应分发处理层
 */
public class UserResponseHandler {


    private UserResponseService userResponseService = new UserResponseServiceImpl();


    public void handler(WebSocket conn, Result result) {

        if (result.getCommand().equals(SubmoduleTypeConstant.USER_LOGIN)){ //用户登录请求
            userResponseService.userLogin(conn, result);
        } else if (result.getCommand().equals(SubmoduleTypeConstant.USER_REGISTER)) { //用户注册请求
            userResponseService.userRegister(conn,result);
        } else if (result.getCommand().equals(SubmoduleTypeConstant.USER_LOGOUT)) { //用户注销请求
            userResponseService.userLogout(conn, result);
        } else if (result.getCommand().equals(SubmoduleTypeConstant.BAG)) {
            userResponseService.getBag(conn,result);
        }else if (result.getCommand().equals(SubmoduleTypeConstant.PETS)){
            userResponseService.getPets(conn,result);
        } else if(result.getCommand().equals(SubmoduleTypeConstant.SHOP)) {
            userResponseService.getShow(conn,result);
        } else if (result.getCommand().equals(SubmoduleTypeConstant.BUY)) {
            userResponseService.getBuy(conn,result);
        }else if (result.getCommand().equals(SubmoduleTypeConstant.MAP)) {
            userResponseService.getMap(conn,result);
        } else if (result.getCommand().equals(SubmoduleTypeConstant.PVE)) {
            userResponseService.pve(conn,result);
        } else if (result.getCommand().equals(SubmoduleTypeConstant.MINI_GAME)) {
            userResponseService.miniGame(conn,result);
        } else if (result.getCommand().equals(SubmoduleTypeConstant.SHOW_USER_ONLINE_NAME)){
            userResponseService.showUserOnlineName(conn,result);
        }


    }
}
